package service.impl;

import java.sql.SQLException;
import java.util.List;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import model.UserModel;
import service.UserService;

public class UserServiceImpl implements UserService {

	@Override
	public UserModel login(UserModel userModel) throws Exception {
		UserDao dao=new UserDaoImpl();
		UserModel u=dao.findByUP(userModel);
		return u;
	}

	UserDao userdao=new UserDaoImpl();
	@Override
	public List<UserModel> findByName(String username) throws SQLException {
		return userdao.findByName(username);
	}
	@Override
	public UserModel modifyP(UserModel userModel,String oldpassword) throws Exception {
		UserDao dao=new UserDaoImpl();
		UserModel u=dao.modifyByP(userModel, oldpassword);
		return u;
	}
	@Override
	public UserModel modifyM(UserModel userModel) throws Exception {
		UserDao dao=new UserDaoImpl();
		UserModel u=dao.modifyByM(userModel);
		return u;
	}
}
